{% set page_toc = get_page_toc_object() %}

{% include "edit_this_page.html" %}
{%- if page_toc.children | length > 1 %}
<div class="tocsection onthispage"><i class="fas fa-list"></i> On this page</div>
{% endif -%}
<nav id="bd-toc-nav">
    <ul class="nav section-nav flex-column">
    {% for item in page_toc.children recursive %}
        <li class="nav-item toc-entry toc-h{{ loop.depth + 1 }}">
            <a href="{{ item.url }}" class="nav-link">{{ item.title }}</a>
        {%- if item.children -%}
            <ul class="nav section-nav flex-column">
                {{ loop(item.children) }}
            </ul>
        {%- endif %}
        </li>
    {% endfor %}
    </ul>
</nav>
